<volist name='cond' id='vo'>
	<div style='display:flex;margin-top:16px'>
		<div style='flex:3;text-align:right'>{$vo.cond_name}：</div>		
		<div style='flex:8'>
			<select  style='width:90%'  name='{$vo.cond_name_form}'>
				<volist name='vo.cond2' id='vo2'>
					<option value='{$vo2.cond_id},{$vo2.cond_name}'>{$vo2.cond_name}</option>
				</volist>
			</select>
		</div>
	</div>
</volist>

<div style='display:flex;margin-top:16px'>
	<div style='flex:3;text-align:right'>标题：</div>		
	<div style='flex:8'>
		<input name='title' style='width:90%'/>
	</div>
</div>
<if condition="$service_name neq '寻物寻人' ">
	<div style='display:flex;margin-top:16px'>
		<div style='flex:3;text-align:right'>
			<if condition="$service_name eq 求职招聘">
				薪资：
			<else/>
				价格：
			</if>
		</div>		
		<div style='flex:2'>
			<input name='price' style='width:90%'/>
		</div>
		<div style='flex:6'>元　<span style='color:red'>空为面议</span></div>
	</div>
</if>


<!--房屋-->
<if condition="$service_name eq '房屋租售' ">
	<div style='display:flex;margin-top:16px'>
		<div style='flex:3;text-align:right'>面积：</div>		
		<div style='flex:2'>
			<input name='area' style='width:90%'/>
		</div>
		<div style='flex:6'>平米</div>
	</div>
</if>

<!--二手车-->
<if condition="$service_name eq '二手车辆' ">
	<div style='display:flex;margin-top:16px'>
		<div style='flex:3;text-align:right'>车身颜色：</div>		
		<div style='flex:8'>
			<select name='color'>
				<option value='黑'>黑</option>
				<option value='白'>白</option>
				<option value='灰'>灰</option>
				<option value='银'>银</option>
				<option value='棕'>棕</option>
				<option value='红'>红</option>
				<option value='绿'>绿</option>
				<option value='蓝'>蓝</option>
				<option value='黄'>黄</option>
				<option value='紫'>紫</option>
				<option value='其它'>其它</option>
			</select>
			<!--input name='color' style='width:23%'/--> 色
		</div>
	</div>
	<div style='display:flex;margin-top:16px'>
		<div style='flex:3;text-align:right'>上牌时间：</div>		
		<div style='flex:8'>
			<!--input name='register_time' style='width:25%'/-->
			<select name='register_time_year'>
		`		<for start='1990' end='$year' comparison='elt' name='k'>
					<option value='{$k}'>{$k}</option>
				</for>
				<option value='oter'>其它</option>
			</select>　年　
			<select name='register_time_month'>
		`		<for start='1' end='12' comparison='elt' name='k'>
					<option value='{$k}'>{$k}</option>
				</for>
			</select>　月
		</div>
	</div>
	<div style='display:flex;margin-top:16px'>
		<div style='flex:3;text-align:right'>行驶里程：</div>		
		<div style='flex:8'>
			<input name='mileage' style='width:23%'/>　公里
		</div>
	</div>
	<div style='display:flex;margin-top:16px'>
		<div style='flex:3;text-align:right'>年检到期：</div>		
		<div style='flex:8'>
			<!--input name='check_time' style='width:90%'/-->
			<select name='check_time_year'>
		`		<for start='$year-3' end='$year+6' comparison='elt' name='k'>
					<option value='{$k}'>{$k}</option>
				</for>
				<option value='other'>其它</option>
			</select>　年　
			<select name='check_time_month'>
		`		<for start='1' end='12' comparison='elt' name='k'>
					<option value='{$k}'>{$k}</option>
				</for>
			</select>　月
		</div>
	</div>
	<div style='display:flex;margin-top:16px'>
		<div style='flex:3;text-align:right'>交强险到期：</div>		
		<div style='flex:8'>
			<!--input name='insurance_traffic' style='width:90%'/-->
			<select name='insurance_traffic_year'>
		`		<for start='$year-3' end='$year+10' comparison='elt' name='k'>
					<option value='{$k}'>{$k}</option>
				</for>
				<option value='other'>其它</option>
			</select>　年　
			<select name='insurance_traffic_month'>
		`		<for start='1' end='12' comparison='elt' name='k'>
					<option value='{$k}'>{$k}</option>
				</for>
			</select>　月
		</div>
	</div>
	<div style='display:flex;margin-top:16px'>
		<div style='flex:3;text-align:right'>商业险到期：</div>		
		<div style='flex:8'>
			<!--input name='insurance_business' style='width:90%'/-->
			<select name='insurance_business_year'>
		`		<for start='$year-3' end='$year+10' comparison='elt' name='k'>
					<option value='{$k}'>{$k}</option>
				</for>
				<option value='other'>其它</option>
			</select>　年　
			<select name='insurance_business_month'>
		`		<for start='1' end='12' comparison='elt' name='k'>
					<option value='{$k}'>{$k}</option>
				</for>
			</select>　月
		</div>
	</div>
	<div style='display:flex;margin-top:16px'>
		<div style='flex:3;text-align:right'>看车地址：</div>		
		<div style='flex:8'>
			<input name='look_addr' style='width:90%'/>
		</div>
	</div>
</if>




<div style='display:flex;margin-top:16px'>
	<div style='flex:3;text-align:right'>联系人：</div>		
	<div style='flex:8'>
		<input name='contacts' style='width:90%'/>
	</div>
</div>

<div style='display:flex;margin-top:16px'>
	<div style='flex:3;text-align:right'>电话：</div>		
	<div style='flex:8'>
		<input name='phone' style='width:90%'/>
	</div>
</div>

<div style='display:flex;margin-top:16px'>
	<div style='flex:3;text-align:right'>详情描述：</div>		
	<div style='flex:8'>
		<textarea rows='10' name='content' style='width:90%;resize:none'></textarea>
	</div>
</div>


<div id='serivce_issue_img_upload'></div> <!--加载图片上传插件-->

<div style='display:flex;margin-top:16px'>
	<div style='flex:3;text-align:right'>验证码：</div>		
	<div style='flex:2'>
		<input name='code' style='width:90%'/>
	</div>
	<div style='flex:6'>
		<img src='http://www.service.top/interface.php?type=code' onclick="changeImg(this)" style='width:100px;height:40px' />
	</div>
</div>
<input type='hidden' name='token' />








<script>

	uploadImgIsHide();	//是否隐藏图片上传
	$("select[name=type]").change(function(){
		uploadImgIsHide(); 	//是否隐藏图片上传
	});

	//点击刷新验证码
	function changeImg(o){
		if(sessionStorage.ImgTempTime && sessionStorage.ImgTempTime > new Date().getTime()){
		}else{
			sessionStorage.ImgTempTime = new Date().getTime() + 1000;
			o.src = o.src+'&r='+Math.random();
		}
	}
	$(function(){
		//加载图片上传插件
		$.ajax({
			url:'plugin_imgUpload.html',
			success:function(res){
				$('#serivce_issue_img_upload').html(res);
			}
		});



		//表单提交
		$('form[name=issue]').submit(function(){
			var p = /^.{1,50}$/;
			if(!p.test($('input[name=title]').val().trim())){
				alert('标题非法！');
				return false;
			}

			if('{$service_name}' != '寻物寻人'){
				if($('input[name=price]').val().trim()){
					var p = /^[1-9][0-9]{0,8}$/;
					if(!p.test($('input[name=price]').val().trim())){
						if('{$service_name}' == '求职招聘'){
							alert('薪资输入不正确！');
						}else{
							alert('价格输入不正确！');
						}
						return false;
					}
				}
			}

			var p = /^[a-zA-z,\u4e00-\u9fa5]{1,12}$/;
			//var p = /^[^0-9]{1,12}$/;
			if(!p.test($('input[name=contacts]').val().trim())){
				alert('联系人添写不正确！');
				return false;
			}

			var p = /^[1-9][0-9]{6,11}$/;
			if(!p.test($('input[name=phone]').val().trim())){
				alert('电话格式不正确！');
				return false;
			}
			
			var p = /^.{1,500}$/;
			if(!p.test($('textarea[name=content]').val().trim())){
				alert('详情字符数量非法！');
				return false;
			}


	
			if('{$service_name}' == '二手车辆'){
				//里程
				var p = /^[1-9][0-9]{0,6}$/;
				if(!p.test($('input[name=mileage]').val().trim())){
					alert('里程输入非法！');
					return false;
				}
				//看车地址
				var p = /^.{0,150}$/;
				if(!p.test($('input[name=look_addr]').val().trim())){
					alert('看车地址输入超限！');
					return false;
				}


			}

			if('{$service_name}' == '房屋租售'){		//房屋
				var p = /^[1-9][0-9]{0,4}(?:[1-9]?|[1-9]?[.](?:[1-9]|[0-9][1-9]))$/;
				if(!p.test($('input[name=area]').val().trim())){
					alert('面积输入非法！');
					return false;
				}
			}





			if(!$('input[name=code]').val().trim()){
				alert('验证码不得为空！');
				return false;
			}
			var token_stat = true;
			$.ajax({
				url:'interface.php?type=issue_c_code_v',
				type:'post',
				data:{
					code:$('input[name=code]').val().trim()  //对验证码进行验证
				},
				async:false,
				success:function(res){  
					$.ajax({
						url:"interface.php",
						data:{
							type:'token',
						},
						async:false,
						success:function(token){
							//alert(token);
							if(!token){
								token_stat = false;
							}
							$('input[name=token]').val(token);
						}
					});
					if(res == 'ok'){
					}else{
						//alert('验证码输入不正确！');
						//token_stat = false;
					}
				}
			})
			if(!token_stat){
				return false;
			}
			//return false;
		});
	});

//是否隐藏图片上传
function uploadImgIsHide(){
	var subTypeName = $("select[name=type]").find("option:selected").text();
	if(subTypeName == '求兑' || subTypeName == '求购' || subTypeName == '求购' || subTypeName == '求租' || subTypeName == '求职'){
		$("#serivce_issue_img_upload").hide();
	}else{
		$("#serivce_issue_img_upload").show();
	}
}
</script>